var Guid = Class.create();

Object.extend(Guid, {
  get: function() {
    cached_guid = Application.getCookie('guid');
    if (cached_guid && (cached_guid != "")) {
      return cached_guid;
    }
  
    guid_obj = document.getElementById('guid_holder');  
    
    if (guid_obj) {
      guid = guid_obj.getGUID();
      if (guid && (guid != "null") && (guid != "")) {
        Application.setCookie('guid', guid);
      }
      
      return guid;
    }
    else {
      return "";
    }
  },
  
  reg: function() {
    new Ajax.Request('/guid/' + Guid.get(), {
      method: 'get'
    });
  }
});

